import StartProcess from '@/apis/StartProcess.js'
export default {
  name: 'DateSelect',
  props: ['label'],
  data() {
    return {
      nowValue: '',
      currentDate: '',
      ifShow: false,
      minDate: new Date().getTime(),
    }
  },
  methods: {
    showPopup() {
      this.ifShow = true
    },
    dataCancel() {
      this.ifShow = false
    },
    dataConfirm(event) {
      const value = event.detail
      const time = new Date(value)
      const timeData = new Date(
        time.getFullYear(),
        time.getMonth(),
        time.getDate(),
        time.getHours()
      ).getTime()
      this.nowValue = this.dateForm(timeData)
      this.$emit('getSelectDate', timeData)
      this.dataCancel()
    },
    dateForm(date) {
      const time = new Date(date)
      return (
        time.getFullYear() +
        '年' +
        (time.getMonth() + 1) +
        '月' +
        time.getDate() +
        '日' +
        time.getHours() +
        '时'
      )
    },
    formatter(type, value) {
      if (type === 'year') {
        return `${value}年`
      }
      if (type === 'month') {
        return `${value}月`
      }
      if (type === 'day') {
        return `${value}日`
      }
      if (type === 'hour') {
        return `${value}时`
      }
      if ((type = 'minute')) {
        return ``
      }
    },
  },
}
